package com.lili.math;

/**
 * @Auther: 李 力
 * @Date: 2024/8/2
 * @Description: 颠倒二进制位
 * @version: 1.0
 */
public class LeetCode190 {

    public static int reverseBits(int n) {
        int rev = 0;
        for (int i = 0; i < 32 && n != 0; i++) {
            rev = rev | (n & 1) << (31 - i);
            n = n >>> 1;
        }
        return rev;
    }

}
